function news() {
    var newsTitle = document.getElementById('newsTitle').value;
    var newsContent = document.getElementById('newsContent').value;
    var newsCategory = document.getElementById('newsCategory').value;
    var errorMessage = document.getElementById('error-message');

    if(newsCategory==="0"){
        errorMessage.textContent = '选择一个有效类别';
        setTimeout(function() {
            errorMessage.textContent = '';
        }, 3000); // 3000 毫秒后清除错误消息
        return false;
    }

    // 这里可以添加更多的验证规则，例如密码长度等

    errorMessage.textContent = '';
    return true;
}